package com.xy.generate.cli.command;

import com.xy.generate.cli.command.children.ConfigCommand;
import com.xy.generate.cli.command.children.GenerateCommand;
import com.xy.generate.cli.command.children.ListCommand;
import com.xy.generate.cli.demoCli;
import picocli.CommandLine;

@CommandLine.Command(name = "executor", description = "executor command", mixinStandardHelpOptions = true)
public class CommandExecutor implements Runnable {
    private final CommandLine commandLine;

    {
        commandLine = new CommandLine(this).
                addSubcommand(new GenerateCommand())
                .addSubcommand(new ListCommand())
                .addSubcommand(new ConfigCommand());
    }

    @Override
    public void run() {
        System.out.println("欢迎使用低代码生成工具,输入--help查看命令提示");
    }

    //执行命令
    public Integer execute(String[] args) {
        return commandLine.execute(args);
    }
}
